package controllers

import (
	"quickstart/models"

	"github.com/astaxie/beego"
)

type LoginControllers struct {
	beego.Controller
}

func (c *LoginControllers) Get() {
	c.TplName = "login.html"
}

func (c *LoginControllers) Post() {
	username := c.GetString("username")
	password := c.GetString("password")
	if username == "" || password == "" {
		return
	}
	user := models.CheckAdminUser(username, password)
	c.Data["json"] = &user
	c.ServeJSON()
}
